<?php

class Application_Model_Relation
{
	protected $_relation_id;
	protected $_member_id;
	protected $_specific_mbm_id;
	protected $_relation_type;
	protected $_creation_time;
	
	protected $_username;
	
    public function __construct(array $options = null)
    {
        if (is_array($options)) {
            $this->setOptions($options);
        }
    }

    public function __set($name, $value)
    {
        $method = 'set' . $name;
        if (('mapper' == $name) || !method_exists($this, $method)) {
            throw new Exception('Invalid relation property');
        }
        $this->$method($value);
    }

    public function __get($name)
    {
        $method = 'get' . $name;
        if (('mapper' == $name) || !method_exists($this, $method)) {
            throw new Exception('Invalid relation property');
        }
        return $this->$method();
    }

    public function setOptions(array $options)
    {
        $methods = get_class_methods($this);
        foreach ($options as $key => $value) {
            $method = 'set' . ucfirst($key);
            if (in_array($method, $methods)) {
                $this->$method($value);
            }
        }
        return $this;
    }

    public function setRelation_id($id)
    {
        $this->_relation_id = (string) $id;
        return $this;
    }

    public function getRelation_id()
    {
        return $this->_relation_id;
    }
    
	public function setMember_id($id)
    {
        $this->_member_id = (string) $id;
        return $this;
    }

    public function getMember_id()
    {
        return $this->_member_id;
    }
    
	public function setSpecific_mbm_id($id)
    {
        $this->_specific_mbm_id = (string) $id;
        return $this;
    }

    public function getSpecific_mbm_id()
    {
        return $this->_specific_mbm_id;
    }
    
	public function setRelation_type($type)
    {
        $this->_relation_type = (string) $type;
        return $this;
    }

    public function getRelation_type()
    {
        return $this->_relation_type;
    }
    
	public function setCreation_time($text)
    {
        $this->_creation_time =  $text;
        return $this;
    }

    public function getCreation_time()
    {
        return $this->_creation_time;
    }
    
	public function setUsername($text)
    {
        $this->_username =  $text;
        return $this;
    }

    public function getUsername()
    {
        return $this->_username;
    }
}

